package javase1.day08.demo02.day09.demo13;

import java.util.ArrayList;
import java.util.Random;

public class Member extends User{
    public Member() {
    }

    public Member(String name, int money) {
        super(name, money);
    }
    public void receive(ArrayList<Integer> list){
        //收红包就是随机的从集合中抽取索引
        int index=new Random().nextInt(list.size());
        //根据索引删除红包，拿到删除红包给自己
        int delta=list.remove(index);
        //查看自己当前余额
        int leftmoney=super.getMoney();
        //拿到红包加在自己余额上
        super.setMoney(leftmoney+delta);


    }
}
